package com.arcanite.dailyplanner.view.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.arcanite.dailyplanner.R;

/**
 *
 * Created by Arcanite on 2016/10/19.
 */

public class DailyFragment extends ContentFragment {
    public static final String DATE = "date";
    private String mDate;

    public static DailyFragment newInstance(int id){
        Bundle bundle = new Bundle();
        bundle.putString(DailyFragment.DATE, getDate(id));
        DailyFragment fragment = new DailyFragment();
        fragment.setArguments(bundle);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mDate = getArguments().getString(DATE);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_daily, container, false);
        TextView tv_date = (TextView) view.findViewById(R.id.tv_date);
        tv_date.setText(mDate);
        return view;
    }

    private static String getDate(int id) {
        switch (id){
            case R.string.sunday:
                return "2016-10-16";

            case R.string.monday:
                return "2016-10-17";

            case R.string.tuesday:
                return "2016-10-18";

            case R.string.wednesday:
                return "2016-10-19";

            case R.string.thursday:
                return "2016-10-20";

            case R.string.friday:
                return "2016-10-21";

            case R.string.saturday:
                return "2016-10-22";

            default:
                return "null";
        }
    }
}
